package org.neowei.image.commond.Handle;

import org.neowei.image.api.ImageOption;
import org.neowei.image.commond.CmdOption;

public class CropHandle extends AbstractHandle {
	
	@Override
	public void doHandle(ImageOption imageOption) throws Exception {
		CmdOption cmdOption = this.getCmdOption("convert");
		String hwstr = super.getStrHeightWidth(super.imageOption.getNeowidth(), super.imageOption.getNeoheight());
		String cropStr = new StringBuffer(hwstr).append('+').append(super.imageOption.getCropX()).append('+').append(super.imageOption.getCropY()).toString();
		cmdOption.AddRow("-crop", cropStr).AddRow("-gravity", "center");
		super.crop(cmdOption);
	}
}
